package com.big.codegen.controller;

import com.big.codegen.domain.dto.CodegenTableConfigDTO;
import com.big.codegen.domain.dto.ColumnDTO;
import com.big.codegen.domain.entity.CodegenTableConfig;
import com.big.codegen.service.CodegenTableConfigService;
import com.big.common.core.result.Result;
import com.big.common.mybatis.base.controller.BaseController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 代码生成表配置Controller
 *
 * @author 山归岿
 * @create 2025-01-03
 */
@Slf4j
@RestController
@RequestMapping("/table-config")
@Tag(name = "代码生成表配置管理", description = "代码生成表配置相关接口")
public class CodegenTableConfigController extends BaseController<CodegenTableConfigDTO, CodegenTableConfig, CodegenTableConfigService> {

    public CodegenTableConfigController(CodegenTableConfigService service) {
        super(service);
    }

    @Operation(summary = "获取通用字段")
    @GetMapping("/common/fields")
    public Result<List<ColumnDTO>> getCommonFields() {
        List<ColumnDTO> fields = service.getCommonFields();
        return Result.ok(fields);
    }
}